package com.ruoyi.user.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.user.mapper.UserCapitalFlowMapper;
import com.ruoyi.user.pojo.ConsultantIncomeDTO;
import com.ruoyi.user.domain.UserCapitalFlow;
import com.ruoyi.user.service.IUserCapitalFlowService;

/**
 * 用户资金流水Service业务层处理
 * 
 * @author DEREK
 * @date 2023-05-23
 */
@Service
public class UserCapitalFlowServiceImpl extends ServiceImpl<UserCapitalFlowMapper, UserCapitalFlow> implements IUserCapitalFlowService 
{
	@Autowired
	private UserCapitalFlowMapper userCapitalFlowMapper;

	/**
	 * 查询用户资金流水
	 * 
	 * @param id 用户资金流水主键
	 * @return 用户资金流水
	 */
	@Override
	public UserCapitalFlow selectUserCapitalFlowById(Long id)
	{
		return userCapitalFlowMapper.selectUserCapitalFlowById(id);
	}

	/**
	 * 查询用户资金流水列表
	 * 
	 * @param userCapitalFlow 用户资金流水
	 * @return 用户资金流水
	 */
	@Override
	public List<UserCapitalFlow> selectUserCapitalFlowList(UserCapitalFlow userCapitalFlow)
	{
		return userCapitalFlowMapper.selectUserCapitalFlowList(userCapitalFlow);
	}

	/**
	 * 新增用户资金流水
	 * 
	 * @param userCapitalFlow 用户资金流水
	 * @return 结果
	 */
	@Override
	public int insertUserCapitalFlow(UserCapitalFlow userCapitalFlow)
	{
		userCapitalFlow.setCreateTime(DateUtils.getNowDate());
		return userCapitalFlowMapper.insertUserCapitalFlow(userCapitalFlow);
	}

	/**
	 * 修改用户资金流水
	 * 
	 * @param userCapitalFlow 用户资金流水
	 * @return 结果
	 */
	@Override
	public int updateUserCapitalFlow(UserCapitalFlow userCapitalFlow)
	{
		return userCapitalFlowMapper.updateUserCapitalFlow(userCapitalFlow);
	}

	/**
	 * 批量删除用户资金流水
	 * 
	 * @param ids 需要删除的用户资金流水主键
	 * @return 结果
	 */
	@Override
	public int deleteUserCapitalFlowByIds(Long[] ids)
	{
		return userCapitalFlowMapper.deleteUserCapitalFlowByIds(ids);
	}

	/**
	 * 删除用户资金流水信息
	 * 
	 * @param id 用户资金流水主键
	 * @return 结果
	 */
	@Override
	public int deleteUserCapitalFlowById(Long id)
	{
		return userCapitalFlowMapper.deleteUserCapitalFlowById(id);
	}

	@Override
	public List<ConsultantIncomeDTO> consultantIncomeList(ConsultantIncomeDTO consultantIncomeDTO) {
		List<ConsultantIncomeDTO> consultantIncomeList = userCapitalFlowMapper.consultantIncomeList(consultantIncomeDTO);
//		consultantIncomeList.stream().forEach(inc ->{
//			switch (inc.getBusinessType()) {
//			case "3":
//				inc.setBusinessType("被采纳回复");
//				break;
//			case "6":
//				inc.setBusinessType("礼物收益");
//				break;
//			case "8":
//				inc.setBusinessType("语音通话收益");
//				break;
//			case "10":
//				inc.setBusinessType("咨询项目收益");
//				break;
//			default:
//				break;
//			}
//		});
		return consultantIncomeList;
	}
}
